<?PHP
	// *******************************************************************************************
	// @Namespace : Colibri.Web.UI
	// @Description : Define a base web control.
	// @Author : Ronald Guillen
	// *******************************************************************************************
	
	class WebControl
	{
		var $Name;
		var $Text = NULL;
		var $Value = NULL;
		var $Width = 0;
		var $Height = 0;
		var $Visible = true;
		var $CssClass = NULL;
		var $Properties = Array();
		
		// [Event] WebControl.OnPostBack()
		function OnPostBack()
		{
			// # Implementar en objetos heredados.
		}
		
		// @ Methods
		
		function drawControl( $args = Array() )
		{
			$this->saveArgs( $args );

			if($this->getProperty("Visible") != "False")
			{
				$this->ToHtml();
			}
		}
		
		// @ Helpers
		
		function saveArgs( $args )
		{   
			$args = array_change_key_case( $args, CASE_LOWER );
		
		    while ( list( $key, $value ) = each ( $args ) )
		    {
		       if($this->getProperty( $key ) == NULL)
		       {
					$this->Properties[ $key ] = $value;

		       }
		  	}
		}
	  	
		function getProperty( $key )
		{
			$key = strtolower( $key );
			
			if ( isset( $this->Properties[ $key ] ) && $this->Properties[ $key ] != NULL )
			{
				return $this->Properties[ $key ];
			}
			  
			return NULL;
		}
	}
